<template>
  <div>
    <Navbar></Navbar>
    <div id="root">
      <div id="one">
        <div id="head">
          <span>话题分类</span>
          <span>{{this.$route.params.name}}</span>
          <span style="color:#636a86;font-size:18px">{{this.$route.params.name}}</span>
          <span style="color:#636a86;font-size:18px">小组</span>
          <br>
          <span style="color:#ccc;font-size:12px">共619个话题</span>
          <br>
          <br>
          <span>老少皆宜。务中心思想灌水小组。</span>
        </div>
        
        
        <div id="line" v-for="t in title">
          <div>
            <img class="yangshi" :src="'http://127.0.0.1:3000'+t.sellid.avatar" alt="">
            <span>{{t.title}}</span>
          </div>
          <div><span id="reply">{{t.reply.length}}</span></div>
        </div>
      </div>
      <!--{{title}}-->
      <div id="line" v-for="t in fenqu.data.data" @click="details(t._id)">
      <div>
        <img class="yangshi" :src="'http://127.0.0.1:3000'+t.sellid.avatar" alt="">
        <span>{{t.title}}</span>
      </div>
      <div><span id="reply">{{t.reply.length}}</span></div>
    </div>
    </div>
  </div>
</template>

<script>
  import {mapState} from "vuex";
  import Navbar from "../components/Navbar.vue"
  export default {
    components: { Navbar },
    mounted:function(){
      var data = this.$route.params.name;
      // console.log(data)
      this.$store.dispatch("fenqu",data);
    },
    computed:{
      ...mapState([
        "fenqu",
        // "title"
      ]) 
    },
    methods:{
      details(e){
        // console.log(123,e)
        this.$store.dispatch("details",e);
        
        
      }
    }
  }

</script>

<style scoped>
  #root {
    padding: 12px;
  }

  #one {
    background-color: rgb(238, 238, 238);
    width: 100%;
  }
  #head{
    padding: 8px;
  }
  #line {
    border-bottom: 1px solid #eee;
    padding: 10px 10px;
    display: flex;
    justify-content: space-between;
  }
  .yangshi{
    width: 20px;
    height: 20px;
    border-radius: 50%;
  }
  #reply{
    background-color: #cccccc;
    color: white;
    border-radius: 10px;
    display: block;
    width: 35px;
    height: 18px;
    text-align: center;
    line-height: 18px;
  }
</style>